﻿//编辑采集内容
Normal_CreateKeyWords = function () {

    var Normal_CreateKeyWordsForm = Ext.create("Ext.form.Panel", {
        width: 800,
        height: 600,

        autoScroll: true,
        layout: "anchor",
        defaultType: "textfield",
        labelWidth: 35,
        baseCls: "x-plain",
        defaults: { labelAlign: 'right', msgTarget: "side" },
        buttonAlign: "center",
        items: [new Ext.create("Ext.ux.ueditor", {
            name: "TextContent",
            labelAlign: 'right',
            allowBlank: false,
            fieldLabel: "<font color='red'>*</font>文章内容",
            width: 600,
            height: 300
        })
			],
        dockedItems: [{
            xtype: 'toolbar',
            dock: 'bottom',
            ui: 'footer',
            bodyStyle: "padding:20px;",
            items: [{
                iconCls: 'icon-save',
                text: "生成关键词",
                minWidth: 70,
                handler: function () {
                    //alert(Normal_CreateKeyWordsForm.getForm().isValid())
                    if (Normal_CreateKeyWordsForm.getForm().isValid()) {
                        //弹出效果 Ext.MessageBox.alert("asdf");
                        Ext.MessageBox.show
                                (
                                    {
                                        msg: '正在保存，请稍等...',
                                        progressText: 'Saving...',
                                        width: 300,
                                        wait: true,
                                        waitConfig: { interval: 200 },
                                        icon: 'download',
                                        animEl: 'saving'
                                    }
                                );
                        setTimeout(function () { }, 1000);
                        Normal_CreateKeyWordsForm.form.submit({
                            url: "/manager/Normal_CreateKeyWords/update/",
                            method: "post",
                            success: function (form, action) {
                                console.log(action);
                                var flag = action.result.success;
                                if (flag == true) {
                                    Normal_CreateKeyWordsForm.form.findField("TextContent").setValue(action.result.data);
                                    Ext.MessageBox.hide();
                                }
                                else {
                                    var message = action.result.message;
                                    if (message) {
                                        Ext.MessageBox.alert("修改失败!", message);
                                    }
                                    else {
                                        Ext.MessageBox.alert("提示!", "修改失败!");

                                    }

                                }
                            },
                            failure: function (form, action) {
                                //Ext.Msg.alert("提示信息","对不起加载数据失败!请联系管理员");
                            }
                        });
                    }
                }
            }]

        }]
    });

    var main2 = Ext.create('Ext.container.Container', {
        padding: '20px;',
        height: 800,
        renderTo: "Normal_CreateKeyWordsForm",
        layout: {
            type: 'vbox',
            align: 'stretch'
        },

        items: [Normal_CreateKeyWordsForm]
    });
}
Normal_CreateKeyWords();
